<%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 2018/6/14
  Time: 14:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script>
    function check() {
        alert("=======你点了我=======")
    }
    function fun1() {
        // alert("==========")
        var xmlhttp;
        if (window.XMLHttpRequest)
        {
            //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            // IE6, IE5 浏览器执行代码
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                document.getElementById("show").innerHTML=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","http://localhost:8080/javaweb_shopping/ajaxTestServlet",true);
        xmlhttp.send();
    }
</script>
<button onclick="check()"> 点我 </button><br>
用户名：<input type="text" name="uname" id="uname"  value="" onblur="fun1()">
<span id="show" onclick="fun1()"></span>
</body>
</html>
